let obj1 = {
    a: 1,
    b: [2, {e : 1}],
    c: {
        d : 5
    }
}
let obj2 = {
    a: 1,
    b: [2, {e : 1}],
    c: {
        d : 5
    }
}
let obj3 = {
    a: 1,
    b: [2,{e : 2}],
    c: {
        d : 5
    }
}

function judgeObj(obj1,obj2) {
    //? 两者键长度不同 false
    if (Object.keys(obj1).length !== Object.keys(obj2).length) return false;
    //? 类型不同 false
    if (typeof obj1 !== typeof obj2) return false
    //? 开遍历
    for (let o in obj1) {
        const type1 = obj1[o] instanceof Object
        const type2 = obj2[o] instanceof Object
        if (type1 && type2) {
            const res = judgeObj(obj1[o],obj2[o])
            //? 递归结果拿到 为false 则 false
            if (!res) return false
        }
        else {
            if (obj1[o] !== obj2[o]) return false
        }
    }
    return true
}
console.log(judgeObj(obj1, obj2));
console.log(judgeObj(obj1, obj3));
